<template>
  <!-- 页面整体容器 -->
  <div class="home-container">
    <!-- 头部区域 -->
    <header class="header">
      <div class="header-logo">
        <img src="../../assets/photoes/logo.jpg" alt="logo" />
        <span class="system-name">铁岭电网无人机管理平台</span>
      </div>
      <div class="header-info">
        <p class="main-title">智驭无人机</p>
        <p class="sub-title">科技赋能无人机，作业智绘新蓝图</p>
        <el-button type="primary" size="medium">了解详情</el-button>
      </div>
    </header>

    <!-- 功能列表区域
    <section class="function-section">
      <h2 class="section-title">六大功能</h2>
      <div class="function-list">
        <div class="function-item" v-for="(item, index) in functionList" :key="index">
          <img :src="item.img" alt="img" class="function-img" />
          <p class="function-text">{{ item.name }}</p>
        </div>
      </div>
    </section> -->

    <!-- 功能列表区域 -->
    <section class="function-section">
      <h2 class="section-title">六大功能</h2>
      <div class="function-list">
        <div class="function-item" v-for="(item, index) in functionList" :key="index"
          @click="navigateToCourseTypes(index)">
          <img :src="item.img" alt="img" class="function-img" />
          <p class="function-text">{{ item.name }}</p>
        </div>
      </div>
    </section>

    <!-- 课程分类区域
    <section class="course-category-section">
      <h2 class="section-title">课程分类</h2>
      <div class="course-category-content">
        <div class="course-category-left">
          <ul class="category-list">
            <li v-for="(category, idx) in courseCategories" :key="idx">
              {{ category }}
            </li>
          </ul>
        </div>
        <div class="course-category-right">
          <div class="category-desc">
            <p class="desc-text">
              空气动力学是力学的一个分支，研究飞行器或其他物体在同空气或其他气体作相对运动情况下的受力特性、气体的流动规律和伴随发生的物理化学变化。它是在流体力学的基础上，随着航空工业和喷气推进技术的发展而成长起来的一个学科...
            </p>
            <el-button size="small">了解详情</el-button>
          </div>
        </div>
      </div>
    </section> -->

    <!-- 课程列表区域 -->
    <!-- <section class="course-list-section">
      <h2 class="section-title">课程列表</h2>
      <div class="course-list">
        <img src="../../assets/photoes/home/header-bg.jpg" alt="course" class="course-img" />
        <div class="course-item" v-for="(course, cIndex) in courseList" :key="cIndex">
          <div class="course-info">
            <p class="course-name">{{ course.name }}</p>
            <p class="course-time">{{ course.time }}</p>
          </div>
        </div>
        <el-button type="primary" icon="Plus" circle class="add-course-btn" />
      </div>
    </section> -->

    <!-- 关于我们区域 -->
    <!-- <section class="about-us-section">
      <h2 class="section-title">关于我们</h2>
      <div class="about-us-content">
        <img src="../../assets/photoes/home/about-us.png" alt="about-us" class="about-us-img" />
        <div class="about-us-desc">
          <p>
            多年来，我们一直坚持弘扬“努力超越、追求卓越”的企业精神，以服务地方社会经济建设为己任，以服务电力客户为宗旨，加快发展，精益管理，追求经济效益和社会效益并重，在全体干部员工的共同努力下，公司各项事业取得了长足的进步。
          </p>
        </div>
      </div>
    </section> -->

    <!-- 底部区域 -->
    <footer class="footer">
      <div class="footer-top">
        <div class="footer-logo">
          <img src="../../assets/photoes/logo.jpg" alt="logo" />
          <span class="system-name">铁岭电网无人机管理平台</span>
        </div>
        <div class="contact-info">
          <div class="contact-item" v-for="(item, index) in contactInfo" :key="index">
            <img :src="item.img" alt="img" class="size-img">
            <p>{{ item.message }}</p>
          </div>
        </div>
        <div class="qrcode">
          <img src="../../assets/photoes/home/qrcode.png" alt="qrcode" />
          <p>扫一扫关注我们</p>
        </div>
      </div>
      <div class="footer-bottom">
        <p>
          京公网安备 11010502031377 Copyright © 2005 ALL RIGHTS RESERVED
          XXXXX有限公司版权所有
        </p>
        <div class="bottom-right">
          <div class="link-list" v-for="(item, index) in linkList" :key="index">
            <a :href=item.link target="_blank">{{ item.text }}</a>
          </div>
        </div>
      </div>
    </footer>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { useRouter } from 'vue-router' // 引入路由钩子
// 确保路由正确初始化
const router = useRouter()


// 模拟功能列表数据
const functionList = ref([
  {
    img: require("@/assets/photoes/home/work.png"),
    name: "无人机作业工单管理平台",
  },
  {
    img: require("@/assets/photoes/home/car.png"),
    name: "无人机出入库管理系统",
  },
  {
    img: require("@/assets/photoes/home/picture.png"),
    name: "无人机图传片整理程序",
  },
  {
    img: require("@/assets/photoes/home/more.png"),
    name: "网络监控平台整合项目",
  },
  {
    img: require("@/assets/photoes/home/communication.png"),
    name: "输电专业知识学习平台",
  },
  {
    img: require("@/assets/photoes/home/cloud.png"),
    name: "输电线路无人机 5G 网联技术(图传管理)",
  },
]);

// 模拟课程分类数据

// const courseCategories = ref([
//   "分类飞行器空气动力学",
//   "分类二",
//   "分类三",
//   "分类四",
// ]);
const contactInfo = ref([
  { img: require("@/assets/photoes/home/phone.png"), message: "010 - 62209211" },
  { img: require("@/assets/photoes/home/message.png"), message: "ZCGS@BNU.EDU.CN" },
  { img: require("@/assets/photoes/home/print.png"), message: "010 - 62209211" },
]);
// 模拟课程列表数据
// const courseList = ref([
//   { time: "2019-07-15", name: "第1讲：应用空气动力学" },
//   { time: "2019-07-15", name: "第2讲：羽翼飞行器空气动力学基础" },
//   { time: "2019-06-28", name: "第3讲：经典翼型及其气动模型" },
//   { time: "2019-06-18", name: "第4讲：普朗特升力理论" },
//   { time: "2020-06-14", name: "第5讲：大展弧比后撩翼绕流现象与气动特性" },
//   { time: "2020-04-30", name: "第6讲：小展弧比机翼的气动特性与升力面理论" },
//   { time: "2020-04-18", name: "第7讲：低速机身绕流与气动力特性" },
//   { time: "2020-03-29", name: "第8讲：低速翼身组合体气动特性" },
//   { time: "2018-12-07", name: "第9讲：亚声速机翼绕流气动特性（运输机）" },

// ]);
const linkList = ref([
  { link: "https://www.baidu.com/", text: "隐私条款" },
  { link: "https://www.baidu.com/", text: "联系我们" },
  { link: "https://www.baidu.com/", text: "加入我们" },
])

// 添加导航方法
const navigateToCourseTypes = (index) => {
  // 检查是否是"输电专业知识学习平台"被点击（索引为4）
  if (index === 4) {
    router.push({
      name: 'CourseTypes',
      query: { category: '输电专业' } // 可选：传递分类参数
    })
  }
}
</script>

<style scoped>
.home-container {
  width: 100%;
  min-height: 100vh;
  background: #f5f7fa;
  overflow-x: hidden;
}

.header {
  width: 100%;
  height: 600px;
  background: url("../../assets/photoes/home/header-bg.jpg") center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  text-align: center;
  position: relative;
}

.header-logo {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  width: auto;
  position: absolute;
  top: 50px;
  left: 150px;
}

.header-logo img {
  width: auto;
  height: 30px;
  margin-right: 10px;
}

.system-name {
  font-size: 20px;
  margin-left: 10px;
}

.header-info {
  position: absolute;
  top: 200px;
  left: 150px;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: start;
}

.main-title {
  font-size: 36px;
  margin-bottom: 10px;
}

.sub-title {
  font-size: 18px;
  margin-bottom: 50px;
}

.section-title {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
}

.function-list {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  width: 80%;
  margin: 0 auto;
}

.function-item {
  width: 30%;
  text-align: center;
  margin-bottom: 30px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  border-radius: 8px;
}

.function-img {
  width: 30px;
  height: 30px;
}

.function-text {
  color: #199893;
  font-weight: 500;
  font-size: 18px;
}

.course-category-section {
  padding: 30px 0;
}

.course-category-content {
  display: flex;
  width: 100%;
  height: 500px;
  padding: 30px 0;
  margin: 0 auto;
  background: url("../../assets/photoes/home/course-category.jpg") no-repeat center;
  background-size: cover;
  position: relative;

}

.course-category-left {
  width: 30%;
  height: 400px;
  position: absolute;
  top: 0;
  left: 50px;
}

.category-list {
  list-style: none;
  padding: 20px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.category-list li {
  margin-bottom: 30px;
  cursor: pointer;
}

.course-category-right {
  width: 40%;
  display: flex;
  align-items: center;
  background-color: #199893;
  border-top-left-radius: 20px;
  padding: 30px;
  position: absolute;
  bottom: 0;
  right: 0;
}

.category-desc {
  flex: 1;
}

.desc-text {
  color: #fff;
  line-height: 1.5;
}

.course-list-section {
  background: #f5f7fa;
  padding: 30px 0;
}

.course-list {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  width: 80%;
  height: 900px;
  margin: 0 auto;
}

.course-item {
  width: 40%;
  background: #fff;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  padding: 20px;
  border-radius: 8px;
}

.course-img {
  width: 45%;
  height: 250px;
  border-top-left-radius: 20px;
  margin-bottom: 30px;
}

.course-info {
  flex: 1;
}

.course-time {
  color: #999;
  margin-bottom: 5px;
  margin-right: 20px;
}

.about-us-section {
  background: #fff;
  padding: 30px 0;
  position: relative;
}

.about-us-content {
  display: flex;
  width: 100%;
  margin: 0 auto;
  align-items: center;
}

.about-us-img {
  width: 100%;
}

.about-us-desc {
  flex: 1;
  position: absolute;
  top: 70%;
  left: 10%;
  right: 10%;
  border-top-left-radius: 20%;
  background-color: #199893;
  padding: 30px;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
}

.footer {
  background: #333;
  color: #fff;
  padding: 30px 0;
}

.footer-top {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 20px;
}

.footer-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-logo img {
  width: 180px;
  height: 50px;
  margin-bottom: 20px;
}

.contact-info p {
  margin: 5px 0;
}

.contact-item {
  display: flex;
}

.size-img {
  margin-right: 10px;
  width: 20px;
  height: 20px;
}

.qrcode p {
  font-size: 14px;
  color: #999;
}

.qrcode img {
  width: 80px;
  height: 80px;
}

.footer-bottom {
  text-align: center;
  display: flex;
  justify-content: space-around;
}

.footer-bottom p {
  font-size: 14px;
  color: #999;
}

.bottom-right {
  display: flex;
}

.link-list {
  margin: 14px 60px 14px 0;
}

.footer-bottom a {
  color: #999;
  text-decoration: none;
  margin: 14px 0;
  font-size: 14px;
}

a:link,
a:visited {
  color: #999;
}

a:hover,
a:active {
  color: #199893;
}
</style>
